}
else
{
- g_autoptr(GFile) log_file;
+ g_autoptr(GFile) log_file = NULL;
GFileOutputStream* log_stream;
log_file = g_file_new_for_path (opt_log);
if (setsid () < 0)
err (1, "setsid");
/* Daemonising: close stdout/stderr so $() et al work on us */
- freopen("/dev/null", "r", stdin);
- freopen("/dev/null", "w", stdout);
- freopen("/dev/null", "w", stderr);
+ if (freopen("/dev/null", "r", stdin) == NULL)
+ err (1, "freopen");
+ if (freopen("/dev/null", "w", stdout) == NULL)
+ err (1, "freopen");
+ if (freopen("/dev/null", "w", stderr) == NULL)
+ err (1, "freopen");
}
else
{
if (!command->fn)
{
g_autoptr(GOptionContext) context = NULL;
- g_autofree char *help;
+ g_autofree char *help = NULL;
context = ostree_option_context_new_with_commands (commands);